/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.regex.Pattern;

/**
 * <p>Project: app2022 - Set2
 * <p>Powered by webrx On 2022-01-14 17:32:21
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Set2 {
    public static void main(String[] args) {
       var set = new HashSet<String>();
       while(true){
           var s = str();
           if(is(s)){
               set.add(s);
           }
           if(set.size()==11){
               break;
           }
       }
       for(String t : set){
           System.out.printf("%s = 100%n",t);
       }
    }

    public static String str() {
        Random rand = new Random();
        var list = List.of("", "+", "-");
        StringBuilder sbu = new StringBuilder();
        for (int i = 1; i < 9; i++) {
            sbu.append(String.format("%d%s", i, list.get(rand.nextInt(3))));
        }
        sbu.append(9);
        return sbu.toString();
    }

    public static boolean is(String s) {
        var f = false;
        var p = Pattern.compile("[+-]?\\d+");
        var m = p.matcher(s);
        int sum = 0;
        while (m.find()) {
            sum += Integer.parseInt(m.group());
        }
        if (sum == 100) {
            f = true;
        }
        return f;
    }
}
